<?php

namespace App\Models;

use Illuminate\Database\Eloquent\SoftDeletes;


class Department extends BaseModel
{

    use SoftDeletes;

    protected $table = 'department';

    public function children_department()
    {
        return $this->hasMany(Department::class, 'parent_id', 'id')->with('children_department')->select(['id','name','parent_id']);
    }

    public function users()
    {
        return $this->hasMany(User::class);
    }
}
